<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

 <h:head>
 	<title></title>
 </h:head>

<h:body>

<ui:composition template="/webApp/layout/template.xhtml">
<ui:define name="conteudo">
<h:outputScript library="js" name="functions.js" target="head"/>
  
  <h:form prependId="false">
  	<p:growl id="messages" globalOnly="false" showDetail="false" sticky="false" life="3000"/>
	<h:panelGrid>
		<h:panelGrid columns="2">
			<f:facet name="header">
				<p:outputLabel value="Edição de Cliente" />
			</f:facet>
		</h:panelGrid>

	<h:panelGrid id="grid"  columns="2" rendered="#{clienteBean.clientePessoaJuridica.nome == null}">	
		<f:facet name="header">
			<p:outputLabel value="Pessoa Física"/>
		</f:facet>
			
			<p:outputLabel value="CPF:"/>
			<p:outputLabel value="#{clienteBean.clientePessoaFisica.cpf}"/>
			
			<p:outputLabel value="RG:"/>
			<p:outputLabel value="#{clienteBean.clientePessoaFisica.rg}"/>
			
			<p:outputLabel value="Nome:" />
			<p:inputText value="#{clienteBean.clientePessoaFisica.nome}"/>
			
			<p:outputLabel value="Telefone:" />
			<p:inputMask mask="(99) 9999-9999" value="#{clienteBean.clientePessoaFisica.telefoneFixo}"/>

			<p:outputLabel value="Celular:" />
			<p:inputMask mask="(99) 99999-9999" value="#{clienteBean.clientePessoaFisica.telefoneCelular}"/>
	
			<p:outputLabel value="Email:" />
			<p:inputText value="#{clienteBean.clientePessoaFisica.email}">
				<p:ajax event="blur" listener="#{clienteBean.validarEmail}" update="messages" />
			</p:inputText>
	 </h:panelGrid>
	
	
	<h:panelGrid id="grid2" columns="2" rendered="#{clienteBean.clientePessoaFisica.nome == null}">	
		<f:facet name="header">
			<p:outputLabel value="Pessoa Jurídica"/>
		</f:facet>
			<p:outputLabel value="Tipo Pessoa:" />
			<p:outputLabel id="tipoPessoa"  value="#{clienteBean.tipoPessoa}" />
			
			<p:outputLabel value="CNPJ:"/>
			<p:outputLabel value="#{clienteBean.clientePessoaJuridica.cnpj}"/>
			
			<p:outputLabel value="Razão Social:"/>
			<p:outputLabel value="#{clienteBean.clientePessoaJuridica.razaoSocial}"/>
			
			<p:outputLabel value="Nome Fantasia:"/>
			<p:inputText value="#{clienteBean.clientePessoaJuridica.nomeFantasia}"/>
			
			<p:outputLabel value="Nome Contato:" />
			<p:inputText value="#{clienteBean.clientePessoaJuridica.nome}" />
			
			<p:outputLabel value="Telefone Contato:" />
			<p:inputMask mask="(99) 9999-9999" value="#{clienteBean.clientePessoaJuridica.telefoneFixo}"></p:inputMask>

			<p:outputLabel value="Celular Contato:" />
			<p:inputMask mask="(99) 99999-9999" value="#{clienteBean.clientePessoaJuridica.telefoneCelular}"/>
	
			<p:outputLabel value="Email:" />
			<p:inputText value="#{clienteBean.clientePessoaJuridica.email}">
				<p:ajax event="blur" listener="#{clienteBean.validarEmail}" update="messages" />
			</p:inputText>
	</h:panelGrid>	
</h:panelGrid>
		
		<p:commandButton value="Alterar" action="#{clienteBean.alterar}" update="messages"/>				
	</h:form>
</ui:define>
</ui:composition>
</h:body>



</html>